From 56274af09819cea1b0fbb1d2c3c8158667752a81 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Thu, 14 Sep 2017 13:52:06 +0200 Subject: [PATCH] fix confusing error for virtual manifest with no member --- src/cargo/core/workspace.rs | 5 ++--- tests/workspaces.rs | 13 +++---------- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/src/cargo/core/workspace.rs b/src/cargo/core/workspace.rs index 148e1e9ff..1bbcec590 100644 --- a/src/cargo/core/workspace.rs +++ b/src/cargo/core/workspace.rs @@ -169,9 +169,8 @@ impl<'cfg> Workspace<'cfg> { /// indicating that something else should be passed. pub fn current(&self) -> CargoResult<&Package> { self.current_opt().ok_or_else(|| - format!("manifest path `{}` is a virtual manifest, but this \ - command requires running against an actual package in \ - this workspace", self.current_manifest.display()).into() + format!("manifest path `{}` contains no package: The manifest is virtual, \ + and the workspace has no members.", self.current_manifest.display()).into() ) } diff --git a/tests/workspaces.rs b/tests/workspaces.rs index d7eabcf7a..68e9468f0 100644 --- a/tests/workspaces.rs +++ b/tests/workspaces.rs @@ -696,20 +696,13 @@ fn virtual_build_no_members() { let p = project("foo") .file("Cargo.toml", r#" [workspace] - "#) - .file("bar/Cargo.toml", r#" - [project] - name = "bar" - version = "0.1.0" - authors = [] - "#) - .file("bar/src/main.rs", "fn main() {}"); + "#); p.build(); assert_that(p.cargo("build"), execs().with_status(101) .with_stderr("\ -error: manifest path `[..]` is a virtual manifest, but this command \ -requires running against an actual package in this workspace +error: manifest path `[..]` contains no package: The manifest is virtual, \ +and the workspace has no members. ")); } -- 2.30.2